Next: Obtaining Tramp, Up: Top [Contents][Index]
TRAMP is for transparently accessing remote
files from within Emacs. TRAMP enables an easy,
convenient, and consistent interface to remote files as if they
are local files. TRAMP’s transparency
extends to editing, version control, and dired.
TRAMP can access remote hosts using any number
of access methods, such as rsh, rlogin,
telnet, and related programs. If these programs can
successfully pass ASCII] characters,
TRAMP can use them. TRAMP does not
require or mandate 8-bit clean connections.
TRAMP’s most common access method is
through ssh, a more secure alternative to
ftp and other older access methods.
TRAMP on Windows operating systems is
integrated with the PuTTY package, and uses the
plink program.
TRAMP mostly operates transparently in the background using the connection programs. As long as these programs enable remote login and can use the terminal, TRAMP can adapt them for seamless and transparent access.
TRAMP temporarily transfers a remote file’s contents to the local host editing and related operations. TRAMP can also transfer files between hosts using standard Emacs interfaces, a benefit of direct integration of TRAMP in Emacs.
TRAMP can transfer files using any number of
available host programs for remote files, such as
rcp, scp, rsync or (under
Windows) pscp. TRAMP provides easy
ways to specify these programs and customize them to specific
files, hosts, or access methods.
For faster small-size file transfers, TRAMP
supports encoded transfers directly through the shell using
mimencode or uuencode provided such
tools are available on the remote host.
Accessing a remote file through TRAMP entails a series of actions, many of which are transparent to the user. Yet some actions may require user response (such as entering passwords or completing file names). One typical scenario, opening a file on a remote host, is presented here to illustrate the steps involved:
C-x C-f to initiate find-file, enter part of the TRAMP file name, then hit TAB for completion. If this is the first time connection to that host, here’s what happens:
telnet, for example) in the buffer. If on the
other hand, the login name was included in the file name
portion, TRAMP sends the login name followed by
a newline.rsh or for telnet).
TRAMP displays the password prompt in the
minibuffer. TRAMP then sends whatever is entered
to the remote host, followed by a newline.If TRAMP does not receive any messages within a timeout period (a minute, for example), then TRAMP responds with an error message about not finding the remote shell prompt. If any messages from the remote host, TRAMP displays them in the buffer.
For any ‘login failed’ message from the remote host, TRAMP aborts the login attempt, and repeats the login steps again.
Note that for the remote shell,
TRAMP invokes /bin/sh. The remote
host must recognize ‘exec /bin/sh’
and execute the appropriate shell. This shell must support
Bourne shell syntax.
cd and
ls commands to find which files exist on the
remote host. TRAMP sometimes uses
echo with globbing. TRAMP checks if
a file or directory is writable with test. After
each command, TRAMP parses the output from the
remote host for completing the next operation.For inline transfers, TRAMP sends a command, such as ‘mimencode -b /path/to/remote/file’, waits until the output has accumulated in the buffer, decodes that output to produce the file’s contents.
For external transfers, TRAMP sends a command as follows:
rcp user@host:/path/to/remote/file /tmp/tramp.4711
TRAMP reads the local temporary file /tmp/tramp.4711 into a buffer, and then deletes the temporary file.
I hope this has provided you with a basic overview of what happens behind the scenes when you open a file with TRAMP.
Next: Obtaining Tramp, Up: Top [Contents][Index]